Pocket-resources
Usage
See the demo crate.
Tweak your Cargo.toml to use a build script:
[]
# ...
= "build.rs"
[]
= "*"
Create a build.rs
file:
extern crate pocket_resources;
Include the resources where you want:
include!;
This creates a public enum named Resource
. If you want to name it something else, or if you want it private, you should use a module.
You can then load the resource directly from the enum:
let data: & = PathToImagePng.load;
Or load it at runtime:
let data: & = from_name.unwrap.load;